function Node(val) {
    this.value = val;
    this.left = null;
    this.right = null;
}

const a = new Node('a');
const b = new Node('b');
const c = new Node('c');
const d = new Node('d');
const e = new Node('e');
const f = new Node('f');
const g = new Node('g');
const h = new Node('h');

a.left = b;
a.right = c;
b.left = d;
b.right = e;
c.left = f;
c.right = g;
e.left = h;

function breadthSearch(root, target) {
    if (root == null || root.length == 0) return false;
    let tempArr = [];
    for (let i = 0; i < root.length; i++) {
        if (root[i] != null && root[i].value == target) return true;
        else{
            tempArr.push(root[i].left);
            tempArr.push(root[i].right);
        }
    }
    return breadthSearch(tempArr, target);
}

console.log(breadthSearch([a], "b"))